package juc.thread.secuity;

import java.util.concurrent.locks.LockSupport;

/*
* LockSupport -park unpark
* */
public class Test12 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            System.out.println("start...");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("park...");
            LockSupport.park();
            System.out.println("resume...");
        }, "t1");
        t1.start();
        //特点 可以在任意时间点unpark park向下执行(哪怕在park之前)
        LockSupport.unpark(t1);
    }
}
